package org.gis.mapserver.responsewriter;

import java.awt.image.RenderedImage;
import java.io.IOException;
import java.io.OutputStream;
import javax.imageio.ImageIO;

/**
 *
 * @author gus
 */
class BinaryResponseWriter implements ResponseWriter
{
    public static final String IMAGE_TYPE = "png";
    private RenderedImage  renderedImage;

    public BinaryResponseWriter(RenderedImage image)
    {
        this.renderedImage = image;
    }

    public String getContentType()
    {
        return "image/png";
    }

    public void write( OutputStream out ) throws IOException
    {
        ImageIO.write(renderedImage, IMAGE_TYPE, out);
    }

    public void close()
    {}
}
